package com.wzcl.app.controller.student;

import com.alipay.api.AlipayApiException;
import com.wzcl.app.dao.model.Orders;
import com.wzcl.app.model.common.RVO;
import com.wzcl.app.service.AlipayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author beingven
 * @Description TODO
 * @createTime 2020年12月02日 14:03:00
 */
@RestController
@RequestMapping("/aliPay")
@Api(value = "支付宝支付controller", tags = {"支付宝相关接口"})
public class AliPayController {
    @Resource
    private AlipayService alipayService;

    @ApiOperation("创建支付宝PC支付")
    @PostMapping("/create/pcPay")
    public RVO createAliPcPay(@RequestBody Orders orders) throws AlipayApiException {
        return alipayService.createAliPcPay(orders);
    }

    @ApiOperation("支付宝异步回调")
    @PostMapping("/notify/pcPay")
    public synchronized String pcPayNotify(HttpServletRequest request) throws Exception {
        return alipayService.getPcNotify(request);
    }
}